package exception;

public class ThrowsDemo {
    public static void main(String[] args) {
        Student stu = new Student();
        try {
            stu.setAge(1000);
        } catch (IllegalAgeException e) {
//            e.printStackTrace();//打印错误栈跟踪信息
            System.out.println(e.getMessage());
        }
        System.out.println("此人年龄为:" + stu.getAge() + "岁");
    }
}
